<extend name="Layout/ins_popup" />
<block name="content">
	<input type="hidden" name="ajax" id="ajax" value="1">
	<select name="dept_list" id="dept_list" class="hidden">
		{:fill_option($dept_list)}
	</select>
	<div class="popup-frame">
		<input type="hidden" name="ajax" id="ajax" value="1">
		<div class="popup-header">
			<div class="pull-left">
				<h1>添加员工</h1>
			</div>
			<div class="pull-right">
				<a id="btn_save" class="btn" >确定</a>
				<a id="btn_close" class="btn btn-cancel">关闭</a>
			</div>
		</div>
		<div class="popup-body">
			<div class="popup-body-scroll">
				<div class="popup-content">
					<form id="form_data" name="form_data" method="post" >
						<input type="hidden" name="opmode" id="opmode" value="add">
						<div class="layui-sub-form-item">
							<label class="layui-form-label">员工编号*：</label>
							<div class="layui-input-block col-19">
								<input class="layui-input" type="text" id="emp_no" name="emp_no"  check="required" info="请输入员工编号" >
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">姓名*：</label>
							<div class="layui-input-block col-19">
								<input class="layui-input" type="text" id="name" name="name"  check="required" info="请输入姓名" >
							</div>
						</div>
						<div class="layui-sub-form-item hidden">
							<label class="layui-form-label">昵称*：</label>
							<div class="layui-input-block col-19">
								<input class="layui-input" type="text" id="nickname" name="nickname" >
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">性别*：</label>
							<div class="layui-input-block col-10 x-select">
								<select name="sex" id="sex" class="layui-input ">
									<option  value="male">男</option>
									<option value="female">女</option>
								</select>
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">生日*：</label>
							<div class="layui-input-inline">
								<input  type="text" id="birthday" name="birthday"  class="input-date layui-input" check="required" info="请输入生日"  >
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">部门*：</label>
							<div class="layui-input-block  col-19">
								<input class="layui-input" name="dept_name"  id="dept_name" type="text" info="请选择部门" check="required"  />
								<input name="dept_id" id="dept_id" type="hidden" />
								<div class="input-group-btn">
									<a class="add-on" id="btn_select_dept"> <i class="fa fa-search" ></i> </a>
								</div>
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">职位*：</label>
							<div class="layui-input-block  col-19 x-select">
								<select name="position_id" id="position_id" class="layui-input" info="请选择职位" check="required">
									<option value="">选择职位</option>
									{:fill_option($position_list)}
								</select>
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">办公室电话*：</label>
							<div class="layui-input-block col-19">
								<input type="text" id="office_tel" name="office_tel" class="layui-input">
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">移动电话*：</label>
							<div class="layui-input-block col-19">
								<input type="text" id="mobile_tel" name="mobile_tel" class="layui-input">
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">电子邮箱*：</label>
							<div class="layui-input-inline">
								<input type="text" id="email" name="email" class="layui-input">
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">负责业务*：</label>
							<div class="layui-input-inline">
								<input type="text" id="duty" name="duty" class="layui-input">
							</div>
						</div>
						<div class="layui-sub-form-item">
							<label class="layui-form-label">状态*：</label>
							<div class="layui-input-block col-10 x-select">
								<select class="layui-input"  name="is_del" id="is_del">
									<option  value="0">启用</option>
									<option value="1">禁用</option>
								</select>
							</div>
						</div>
						<p class="text-right">
							带*项为必填选项
						</p>
					</form>
				</div>
			</div>
</block>
<block name="js">
	<script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		layui.use('global', function() {
			var $ = layui.jquery;

			//保存后关闭
			$('#btn_save').on('click', function() {
				send_form('form_data', '{:U("save")}', '', function(ret) {
					if (ret.status == 1) {
						parent.layer.msg(ret.info, {
							time : 1200
						}, function() {
							parent.location.reload(true);
							parent.layer.close(index);
						});
					} else {
						layer.msg(ret.info);
						return false;
					}
				});
			});

			//关闭iframe
			$('#btn_close').click(function() {
				parent.layer.close(index);
			});

			$('#btn_select_dept').on('click', function() {
				winopen("{:U('select_dept')}", 560, 470);
			});
		});

	</script>
</block>